From bf57b043c5ed9f0e27cbdf660983d73a574e8543 Mon Sep 17 00:00:00 2001 From: robertl Date: Sun, 13 Aug 2006 21:40:36 +0000 Subject: [PATCH] Fix crash of certain D108 Garmins when writing routes. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@2297 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/garmin.c | 6 ++++++ gpsbabel/jeeps/gpsapp.c | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gpsbabel/garmin.c b/gpsbabel/garmin.c index 054c9c28e..4698f7d7f 100644 --- a/gpsbabel/garmin.c +++ b/gpsbabel/garmin.c @@ -705,6 +705,12 @@ route_waypt_pr(const waypoint *wpt) if (wpt->altitude != unknown_alt) { rte->alt = wpt->altitude; } + if (wpt->altitude != unknown_alt) { + rte->alt = wpt->altitude; + } else { + rte->alt_is_unknown = 1; + rte->alt = 0; + } strncpy(rte->ident, wpt->shortname, sizeof(rte->ident)); rte->ident[sizeof(rte->ident)-1] = 0; diff --git a/gpsbabel/jeeps/gpsapp.c b/gpsbabel/jeeps/gpsapp.c index 204d198b9..104f535c7 100644 --- a/gpsbabel/jeeps/gpsapp.c +++ b/gpsbabel/jeeps/gpsapp.c @@ -2063,7 +2063,11 @@ static void GPS_D108_Send(UC *data, GPS_PWay way, int32 *len) GPS_Util_Put_Int(p,(int32)GPS_Math_Deg_To_Semi(way->lon)); p+=sizeof(int32); - GPS_Util_Put_Float(p,way->alt); + if (way->alt_is_unknown) { + GPS_Util_Put_Float(p,(const float) 1.0e25); + } else { + GPS_Util_Put_Float(p,way->alt); + } p+=sizeof(float); GPS_Util_Put_Float(p,way->dpth); p+=sizeof(float); -- 2.30.2